#! /usr/bin/python
#                   _ooOoo_                     
#                  o8888888o                    
#                  88" . "88                    
#                  (| -_- |)                    
#                  O\  =  /O                    
#               ____/`---'\____                 
#             .'  \\|     |//  `.               
#            /  \\|||  :  |||//  \              
#           /  _||||| -:- |||||-  \             
#           |   | \\\  -  /// |   |             
#           | \_|  \---/  |   |             
#           \  .-\__  `-`  ___/-. /             
#         ___`. .'  /--.--\  `. . __            
#      ."" '<  `.___\_<|>_/___.'  >'"".      
#     | | :  `- \`.;`\ _ /`;.`/ - ` : | |       
#     \  \ `-.   \_ __\ /__ _/   .-` /  /       
#======`-.____`-.___\_____/___.-`____.-'======  
#                   `=---='                     
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
#         Buddha bless me for no bug            
#                                               
####################################################################################
#   Filename    :  eda.py                                                      
#   Author      :  Shawn Tan                                                        
#   Date        :  2017.2.22                                                        
#   Description :                                                                   
#   History     :  2017.2.22             creat the document            Shawn Tan    
####################################################################################

EDA_Vendor_ID = 'synopsys'

EDA_Vendor_List = [
  'synopsys', 
  'cadence',
  'mentor'
]

synopsys_cmd_pre = {
'category'               :  None, 
'git_cfg'                :  None, 
'drm'                    :  None, 
'max_runs_in_parallel'   :  None, 
'run_num'                :  None, 
'top_dir'                :  None, 
'comp_dir'               :  None, 
'sim_dir'                :  None, 
'timescale'              :  ' -timescale=', 
'define_opt'             :  ' +define+', 
'c_test_name'            :  None, 
'comp_opt'               :  None, 
'rtl_comp_opt'           :  None, 
'tb_comp_opt'            :  None, 
'vip_comp_opt'           :  None, 
'vip_file_list'          :  None, 
'rtl_file_list'          :  None, 
'tb_file_list'           :  None, 
'c_files'                :  ' -file ', 
'tb_top'                 :  ' -top ', 
'elab_opt'               :  None, 
'seed'                   :  None, 
'waveform'               :  None, 
'verbosity'              :  ' +UVM_VERBOSITY=UVM_', 
'sim_args'               :  None, 
'uvm_testname'           :  ' +UVM_TESTNAME=', 
'run_script'             :  None, 
'pre_run_script'         :  None, 
'post_run_script'        :  None, 
'post_simulation_script' :  None, 
'pre_group_script'       :  None, 
'post_group_script'      :  None, 
'pass_cfg'               :  None, 
'fail_cfg'               :  None, 
'ignore_cfg'             :  None, 
'pre_session_script'     :  None, 
'post_session_script'    :  None, 
'session_description'    :  None, 
'scan_script'            :  None    
}

synopsys_cmd_post = {
'category'               :  None, 
'git_cfg'                :  None, 
'drm'                    :  None, 
'max_runs_in_parallel'   :  None, 
'run_num'                :  None, 
'top_dir'                :  None, 
'comp_dir'               :  None, 
'sim_dir'                :  None, 
'timescale'              :  None, 
'define_opt'             :  None, 
'c_test_name'            :  None, 
'comp_opt'               :  None, 
'rtl_comp_opt'           :  None, 
'tb_comp_opt'            :  None, 
'vip_comp_opt'           :  None, 
'vip_file_list'          :  None, 
'rtl_file_list'          :  None, 
'tb_file_list'           :  None, 
'c_files'                :  None, 
'tb_top'                 :  None, 
'elab_opt'               :  None, 
'seed'                   :  None, 
'waveform'               :  None, 
'verbosity'              :  None, 
'sim_args'               :  None, 
'uvm_testname'           :  None, 
'run_script'             :  None, 
'pre_run_script'         :  None, 
'post_run_script'        :  None, 
'post_simulation_script' :  None, 
'pre_group_script'       :  None, 
'post_group_script'      :  None, 
'pass_cfg'               :  None, 
'fail_cfg'               :  None, 
'ignore_cfg'             :  None, 
'pre_session_script'     :  None, 
'post_session_script'    :  None, 
'session_description'    :  None, 
'scan_script'            :  None    
}


cadence_cmd_pre = {
'category'               :  None, 
'git_cfg'                :  None, 
'drm'                    :  None, 
'max_runs_in_parallel'   :  None, 
'run_num'                :  None, 
'top_dir'                :  None, 
'comp_dir'               :  None, 
'sim_dir'                :  None, 
'timescale'              :  None, 
'define_opt'             :  None, 
'c_test_name'            :  None, 
'comp_opt'               :  None, 
'rtl_comp_opt'           :  None, 
'tb_comp_opt'            :  None, 
'vip_comp_opt'           :  None, 
'vip_file_list'          :  None, 
'rtl_file_list'          :  None, 
'tb_file_list'           :  None, 
'c_files'                :  None, 
'tb_top'                 :  None, 
'elab_opt'               :  None, 
'seed'                   :  None, 
'waveform'               :  None, 
'verbosity'              :  None, 
'sim_args'               :  None, 
'uvm_testname'           :  None, 
'run_script'             :  None, 
'pre_run_script'         :  None, 
'post_run_script'        :  None, 
'post_simulation_script' :  None, 
'pre_group_script'       :  None, 
'post_group_script'      :  None, 
'pass_cfg'               :  None, 
'fail_cfg'               :  None, 
'ignore_cfg'             :  None, 
'pre_session_script'     :  None, 
'post_session_script'    :  None, 
'session_description'    :  None, 
'scan_script'            :  None    
}

cadence_cmd_post = {
'category'               :  None, 
'git_cfg'                :  None, 
'drm'                    :  None, 
'max_runs_in_parallel'   :  None, 
'run_num'                :  None, 
'top_dir'                :  None, 
'comp_dir'               :  None, 
'sim_dir'                :  None, 
'timescale'              :  None, 
'define_opt'             :  None, 
'c_test_name'            :  None, 
'comp_opt'               :  None, 
'rtl_comp_opt'           :  None, 
'tb_comp_opt'            :  None, 
'vip_comp_opt'           :  None, 
'vip_file_list'          :  None, 
'rtl_file_list'          :  None, 
'tb_file_list'           :  None, 
'c_files'                :  None, 
'tb_top'                 :  None, 
'elab_opt'               :  None, 
'seed'                   :  None, 
'waveform'               :  None, 
'verbosity'              :  None, 
'sim_args'               :  None, 
'uvm_testname'           :  None, 
'run_script'             :  None, 
'pre_run_script'         :  None, 
'post_run_script'        :  None, 
'post_simulation_script' :  None, 
'pre_group_script'       :  None, 
'post_group_script'      :  None, 
'pass_cfg'               :  None, 
'fail_cfg'               :  None, 
'ignore_cfg'             :  None, 
'pre_session_script'     :  None, 
'post_session_script'    :  None, 
'session_description'    :  None, 
'scan_script'            :  None    
}

mentor_cmd_pre = {
'category'               :  None, 
'git_cfg'                :  None, 
'drm'                    :  None, 
'max_runs_in_parallel'   :  None, 
'run_num'                :  None, 
'top_dir'                :  None, 
'comp_dir'               :  None, 
'sim_dir'                :  None, 
'timescale'              :  None, 
'define_opt'             :  None, 
'c_test_name'            :  None, 
'comp_opt'               :  None, 
'rtl_comp_opt'           :  None, 
'tb_comp_opt'            :  None, 
'vip_comp_opt'           :  None, 
'vip_file_list'          :  None, 
'rtl_file_list'          :  None, 
'tb_file_list'           :  None, 
'c_files'                :  None, 
'tb_top'                 :  None, 
'elab_opt'               :  None, 
'seed'                   :  None, 
'waveform'               :  None, 
'verbosity'              :  None, 
'sim_args'               :  None, 
'uvm_testname'           :  None, 
'run_script'             :  None, 
'pre_run_script'         :  None, 
'post_run_script'        :  None, 
'post_simulation_script' :  None, 
'pre_group_script'       :  None, 
'post_group_script'      :  None, 
'pass_cfg'               :  None, 
'fail_cfg'               :  None, 
'ignore_cfg'             :  None, 
'pre_session_script'     :  None, 
'post_session_script'    :  None, 
'session_description'    :  None, 
'scan_script'            :  None    
}

mentor_cmd_post = {
'category'               :  None, 
'git_cfg'                :  None, 
'drm'                    :  None, 
'max_runs_in_parallel'   :  None, 
'run_num'                :  None, 
'top_dir'                :  None, 
'comp_dir'               :  None, 
'sim_dir'                :  None, 
'timescale'              :  None, 
'define_opt'             :  None, 
'c_test_name'            :  None, 
'comp_opt'               :  None, 
'rtl_comp_opt'           :  None, 
'tb_comp_opt'            :  None, 
'vip_comp_opt'           :  None, 
'vip_file_list'          :  None, 
'rtl_file_list'          :  None, 
'tb_file_list'           :  None, 
'c_files'                :  None, 
'tb_top'                 :  None, 
'elab_opt'               :  None, 
'seed'                   :  None, 
'waveform'               :  None, 
'verbosity'              :  None, 
'sim_args'               :  None, 
'uvm_testname'           :  None, 
'run_script'             :  None, 
'pre_run_script'         :  None, 
'post_run_script'        :  None, 
'post_simulation_script' :  None, 
'pre_group_script'       :  None, 
'post_group_script'      :  None, 
'pass_cfg'               :  None, 
'fail_cfg'               :  None, 
'ignore_cfg'             :  None, 
'pre_session_script'     :  None, 
'post_session_script'    :  None, 
'session_description'    :  None, 
'scan_script'            :  None    
}

basic_comp_dict = {
'synopsys'    : '-sverilog -error=noMPD +vpi -nc -ntb_opts uvm ', 
'cadence'     : None,
'mentor'      : None
}

basic_elab_dict = {
'synopsys'    : ' -sverilog -ntb_opts uvm +lint=TFIPOC-L -j4 ', 
'cadence'     : None,
'mentor'      : None
}

basic_coverage_dict = {
'synopsys'    : ' -cm line+tgl+branch+fsm+cond+assert -cm_tgl mda -cm_cond allops ',
'cadence'     : None,
'mentor'      : None
}

basic_coverage_sim_dict = {
'synopsys'    : ' -cm_dir sim -cm line+tgl+branch+fsm+cond+assert ',
'cadence'     : None,
'mentor'      : None
}

basic_sim_dict = {
'synopsys'   : ' +UVM_NO_RELNOTES ', 
'cadence'    : None,
'mentor'     : None
}

basic_profile_dict = {
'synopsys'   : ' -simprofile -lca ', 
'cadence'    : None, 
'mentor'     : None 
}

basic_sim_profile_mem_dict = {
'synopsys'   : ' -simprofile=mem  -simprofile_report ', 
'cadence'    : None, 
'mentor'     : None 
}

basic_sim_profile_time_dict = {
'synopsys'   : ' -lca -simprofile=time  -simprofile_report ', 
'cadence'    : None, 
'mentor'     : None 
}

comp_shell_exit_func = '''export RUNSIM_TOP_PID=$$
trap 'exit 1' TERM

exit_script() {
  kill -s TERM $RUNSIM_TOP_PID 
}
'''

comp_shell_judge_head = '''if [ $? -eq 0 ]; then\n'''
comp_shell_judge_else = '''else\n'''
comp_shell_judge_end  = '''fi\n'''


gls_sim_dict = {
'synopsys'   : ' +fsdb+skip_cell_instance=2 ', 
'cadence'    : None, 
'mentor'     : None 
}

tcl_sim_dict = {
'synopsys'   : ' -ucli -do ', 
'cadence'    : None, 
'mentor'     : None 
}




